home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
326-350
/
disk_339
/
pcq
/
include
/
arexx.i
< prev
next >
Wrap
Text File
|
1992-05-06
|
10KB
|
392 lines
{
ARexx.i of PCQ Pascal
These are the definitions and routines needed to interface
with William Hawes' ARexx language.
}
{$I "Include/Ports.i"}
const
NSF_KEEP = $01;
NSF_STRING = $02;
NSF_NOTNUM = $04;
NSF_NUMBER = $08;
NSF_BINARY = $10;
NSF_FLOAT = $20;
NSF_EXT = $40;
NSF_SOURCE = $80;
type
NexxStr = record
nsIvalue : Integer;
nsLength : Short;
nsFlags : Byte; { NSF_KEEP .. NSF_SOURCE }
nsHash : Byte;
nsBuff : Array [0..7] of Char;
end;
NexxStrPtr = ^NexxStr;
const
NXAddLen = 9;
{ Meaningful combinations of flags }
NSF_INTNUM = NSF_NUMBER + NSF_BINARY + NSF_STRING;
NSF_DPNUM = NSF_NUMBER + NSF_FLOAT;
NSF_ALPHA = NSF_NOTNUM + NSF_STRING;
NSF_OWNED = NSF_SOURCE + NSF_EXT + NSF_KEEP;
KEEPSTR = NSF_STRING + NSF_SOURCE + NSF_NOTNUM;
KEEPNUM = NSF_STRING + NSF_SOURCE + NSF_NUMBER + NSF_BINARY;
type
{
The RexxArg structure is identical to the NexxStr structure, but
is allocated from system memory rather than internal storage. This
structure is used for passing arguments to external programs. It
is usually passed as an "argstring", a pointer to the string buffer.
}
RexxArg = record
raSize : Integer;
raLength: Short;
raFlags : Byte;
raHash : Byte;
raBuff : Array [0..7] of Char;
end;
RexxArgPtr = ^RexxArg;
{
The RexxMsg structure is used for all communications with Rexx
programs. It is an Exec message with a parameter block apppended.
}
RexxMsg = record
rmNode : Message;
rmTaskBlock : Address;
rmLibBase : Address;
rmAction : Integer;
rmResult1 : Integer;
rmResult2 : String;
rmArgs : Array [0..15] of String;
rmPassPort : MsgPortPtr;
rmCommAddr : String;
rmFileExt : String;
rmStdin : Address; { FileHandle }
rmStdout : Address; { FileHandle }
rmAvail : Integer;
end;
RexxMsgPtr = ^RexxMsg;
const
MAXRMARG = 15;
{ Command (action) codes for message packets }
RXCOMM = $01000000;
RXFUNC = $02000000;
RXCLOSE = $03000000;
RXQUERY = $04000000;
RXADDFH = $07000000;
RXADDLIB = $08000000;
RXREMLIB = $09000000;
RXADDCON = $0A000000;
RXREMCON = $0B000000;
RXTCOPN = $0C000000;
RXTCCLS = $0D000000;
{ Command modifier flag bits }
RXFF_RESULT = $00020000;
RXFB_STRING = $00040000;
RXFB_TOKEN = $00080000;
RXFB_NONRET = $00100000;
type
{
The RexxRsrc structure is used to manage global resources. The
name string for each node is created as a RexxArg structure, and the
total size of the node is saved in the rrSize field. Functions are
provided to allocate and release resource nodes. If special deletion
operations are required, an offset and base can be provided in rrFunc
and rrBase, respectively. This function will be called with the base
in register A6 and the node in A0.
}
RexxRsrc = record
rrNode : Node;
rrFunc : Short;
rrBase : Address;
rrSize : Integer;
rrArg1 : Integer;
rrArg2 : Integer;
end;
RexxRsrcPtr = ^RexxRsrc;
const
{ Resource node types }
RRT_ANY = 0;
RRT_LIB = 1;
RRT_PORT = 2;
RRT_FILE = 3;
RRT_HOST = 4;
RRT_CLIP = 5;
GLOBALSZ = 200;
type
{
The RexxTask structure holds the fields used by REXX to communicate with
external processes, including the client task. It includes the global data
structure (and the base environment). The structure is passed to the
newly-created task in its "wake-up" message.
}
RexxTask = record
rtGlobal : Array [1..GLOBALSZ] of Byte;
rtMsgPort : MsgPort;
rtFlags : Byte;
rtSigBit : Integer;
rtClientID : Address;
rtMsgPkt : Address;
rtTaskID : Address;
rtRexxPort : MsgPortPtr;
rtErrTrap : Address;
rtStackPtr : Address;
rtHeader1,
rtHeader2,
rtHeader3,
rtHeader4,
rtHeader5 : List;
end;
RexxTaskPtr = ^RexxTask;
const
RTFF_TRACE = $01;
RTFF_HALT = $02;
RTFF_SUSP = $04;
RTFF_TCUSE = $08;
RTFF_WAIT = $40;
RTFF_CLOSE = $80;
MEMQUANT = 16;
MEMMASK = $FFFFFFF0;
MEMQUICK = $00000001;
xMEMCLEAR = $00010000; { MemClear is defined in Exec.i }
TYPE
{
The SrcNode is a temporary structure used to hold values destined for a
segment array. It is also used to maintain the memory freelist.
}
SrcNode = record
snSucc : ^SrcNode;
snPred : ^SrcNode;
snPtr : Address;
snSize : Integer;
end;
SrcNodePtr = ^SrcNode;
const
RXBuffSz = 204; { Length of IO buffer, to follow }
TYPE
{
The IOBuff is a resource node used to maintain the File List. Nodes
are allocated and linked into the list whenever a file is opened.
}
IOBuff = record
iobNode : RexxRsrc;
iobRpt : Address; { read/write pointer }
iobRct : Integer; { character count }
iobDFH : Integer; { FileHandle }
iobLock : Address; { Lock }
iobBct : Integer; { Buffer length }
iobArea : Array [0..RxBuffSz - 1] of Byte; { Buffer }
end;
IOBuffPtr = ^IOBuff;
const
{ Access mode definitions }
RXIOExist = -1;
RXIOStrF = 0; { a string file }
RXIORead = 1; { read only }
RXIOWrite = 2; { write }
RXIOAppend = 3; { append existing file }
RXIOBegin = -1; { Relative to start }
RXIOCurr = 0; { ...to current position }
RXIOEnd = 1; { and to the end of the file }
{
A message port structure, maintained as a resource node.
The ReplyList holds packets that have been received but
haven't been replied.
}
type
RexxMsgPort = record
rmpNode : RexxRsrc;
rmpPort : MsgPort;
rmpReplyList : List;
end;
RexxMsgPortPtr = ^RexxMsgPort;
StandardPacketPtr = Address;
const
{ DOS Device types }
DTDEV = 0; { a device }
DTDIR = 1; { an ASSIGNed directory }
DTVOL = 2; { a volume }
{ Private DOS packet types }
ActionStack = 2002; { stack a line }
ActionQueue = 2003; { queue a line }
VAR
RexxSysBase : Address;
Function AddClipNode(VAR lst: List; name: String; length: Integer;
value: Address): RexxRsrcPtr;
External;
Function AddRsrcNode(Lst : List; Name : String; Len : Integer): RexxRsrcPtr;
External;
Procedure ClearMem(Add : Address; Len : Integer);
External;
Procedure ClearRexxMsg(msg : RexxMsgPtr; Count : Integer);
External;
Function CloseF(iob: IoBuffPtr): Boolean;
External;
Procedure ClosePublicPort(nod : RexxMsgPortPtr);
External;
Function CmpString(ss1, ss2: NexxStrPtr): Integer;
External;
Function CreateArgstring(S : String; len : Integer): Address;
External;
Function CreateDOSPkt() : StandardPacketPtr;
External;
Function CreateRexxMsg(rp : MsgPortPtr; ex, host : String) : RexxMsgPtr;
External;
Function CVa2i(buf : String; var val : Integer): Integer;
{ DigitsScanned := CVa2i(str, result); }
External;
Function CVc2x(out, str : String; len : Integer;
mode: Integer): Integer;
External;
{ Error := CVc2x(out, in, length, -1 (hex) or 0 (binary)); }
Function CVi2a(buf: String; val, digits : Integer; VAR ptr: String): Integer;
External;
{ Digits := CVi2a(outbuf, 1234, MaxDigits, outbuf); }
Function CVi2arg(val, digs: Integer) : String;
External;
Function CVi2az(buf : String; val, digs : Integer; var ptr : String) : Integer;
External;
{ Digits := CVi2az(buffer, value, maxdigs, buffer); }
Function CVx2c(out, val : String; len, mode : Integer) : Integer;
External;
Function CurrentEnv(rxptr: RexxTaskPtr): Address;
External;
Procedure DeleteArgstring(As : Address);
External;
Procedure DeleteDOSPkt(msg : StandardPacketPtr);
External;
Procedure DeleteRexxMsg(pkt: RexxMsgPtr);
External;
Function RexxDOSRead(f : Address; b : Address; len : Integer): Integer;
External;
Function RexxDOSWrite(f : Address; b : Address; len : Integer): Integer;
External;
Function ErrorMsg(code: Integer; var ss: NexxStrPtr): Boolean;
External;
Function ExistF(f : String): Boolean;
External;
Function FillRexxMsg(mp: RexxMsgPtr; c, m : Integer): Boolean;
External;
Function FindDevice(name: String; tp: Integer): Address;
External;
Function FindRsrcNode(list: ListPtr; name: String; tp : Integer): RexxRsrcPtr;
External;
Procedure FreePort(p : MsgPortPtr);
External;
Procedure FreeSpace(eptr, block: Address; len : Integer);
External;
Function GetSpace(eptr: Address; len: Integer): Address;
External;
Procedure InitList(list: ListPtr);
External;
Function InitPort(p : MsgPortPtr; name: String): Integer;
External;
Function IsRexxMsg(mp: RexxMsgPtr): Boolean;
External;
Function IsSymbol(str : String; var Len : Integer): Integer;
External;
Function LengthArgstring(arg : Address): Integer;
External;
Function ListNames(list: ListPtr; seperator : Char): String;
External;
Procedure LockRexxBase(rc: Integer);
External;
Function OpenF(list: ListPtr; name: String; mode: Integer; log : String) : IOBuffPtr;
External;
Function OpenPublicPort(list: ListPtr; name: String): RexxMsgPortPtr;
External;
Function QueueF(iob: IoBuffPtr; buf : String; len : Integer): Integer;
External;
Function ReadF(iob: IoBuffPtr; buf : String; len : Integer): Integer;
External;
Function ReadStr(iob: IoBuffPtr; buf : Address; len: Integer;
var ptr : Address) : Integer;
External;
Procedure RemClipNode(nd: RexxRsrcPtr);
External;
Procedure RemRsrcList(list: RexxRsrcPtr);
External;
Procedure RemRsrcNode(node: RexxRsrcPtr);
External;
Function SeekF(iob: IoBuffPtr; off : Integer; anchor: Integer): Integer;
External;
Function StackF(iob: IoBuffPtr; buf : String; len : Integer): Integer;
External;
Procedure StcToken(str: String; var Quote : Char; var Len : Integer;
var scan, token : String);
External;
Function StrcpyA(dest, src: String; len: Integer): Byte;
External;
Function StrcpyN(dest, src: String; len: Integer): Byte;
External;
Function StrcpyU(dest, src: String; len: Integer): Byte;
External;
Procedure StrflipN(str: String; length: Integer);
External;
Function RexxStrlen(str: String): Integer;
External;
Function StrcmpN(str1, str2: String; len: Integer): Integer;
External;
Function ToUpper(ch : Char): Char;
External;
Procedure UnlockRexxBase(rsc: Integer);
External;
Function WriteF(iob: IoBuffPtr; buf: Address; len: Integer): Integer;
External;